package com.usian.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usian.pojo.Dept;
import org.apache.ibatis.annotations.Select;

public interface DeptMapper extends BaseMapper<Dept> {
    //根据姓名统计人数
    @Select("select count(*) from dept where name=#{name}")
    Integer findByName(String name);
    //根据部门id查询部门名称
    @Select("select name from dept where id=#{id}")
    String findByName1(Integer id);
    //根据部门id统计员工数量
    @Select("select count(*) from emp e,dept d where e.did=d.id and d.id=#{id}")
    Integer findCount(Integer id);
    //根据名称查询部门数量
    @Select("select count(*) from dept where name=#{name} and id != #{id}")
    Integer findByName2(Integer id, String name);
}











